package com.realshare.bby.service.integral;

import org.beetl.sql.core.SQLManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 核验用户组用户
 * author leisure
 * email 15075107120@139.com
 * create 2018-10-29 下午 4:37
 * modify 2018-10-29 下午 4:37
 **/
@Service
public class AccountSync {
    private Logger log = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private SQLManager sqlManager;

    /**
     * 同步账户信息
     */
    public void sync() {
        log.info("开始同步账户信息");

        log.info("开始同步用户身份信息表");
        // int count = sqlManager.update("syncUserInfo");        @SqlResource("integral.calculate")
        int count = sqlManager.update("integral.calculate.syncUserInfo");
        log.info("结束同步用户信息表，共同步【" + count + "】条数据");

        log.info("开始同步账户信息表");
        count = sqlManager.update("integral.calculate.syncUserAccount");
        log.info("结束同步账户信息表，共同步【" + count + "】条数据");

        log.info("开始更新核心更改的预留手机号");
        count = sqlManager.update("integral.calculate.syncUserUpdatePhone");
        log.info("结束更新核心更改的预留手机号，共更新【" + count + "】条数据");

        log.info("结束同步账户信息");
    }

}
